<include file="Public:head" />
<link href="__APP__/Application/{$Think.MODULE_NAME}/Public/css/login.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/js/jquery/validate.js"></script>
<script src="__PUBLIC__/js/jquery/placeholder.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function(){
        $("input[type=text]").placeholder();
//        jQuery.validator.addMethod("checkUsername", function(value, element) {  
//            var name = $("input[name=name]").val();
//            var pattern = /^[\w\u4e00-\u9fa5]+$/gi;
//            if(pattern.test(name))
//            {
//                return true;
//            }else{
//                return false;
//            }     
//        }); 
        $("#form").validate({
            errorPlacement: function(error, element){
                var error_td = element.parent('li');
                error_td.find('label.error').hide();
                error_td.children("em").remove();
                error_td.append(error);
               
            },
            rules : {
                name : {
                    required : true,
                    minlength: 3,
                    maxlength: 15,
                    remote   : {
                        url :"{:U('Ajax/checkName')}",
                        type:'post',
                        data:{
                            user_name : function(){
                                return $("input[name=name]").val();
                            }
                        }
                    }
                },
                password : {
                    required : true,
                    minlength: 6,
                    maxlength: 20
                },
                password_confirm : {
                    required : true,
                    equalTo  : '#password'
                },
                email : {
                    required : true,
                    email    : true,
                    remote   : {
                        url : "{:U('Ajax/checkEmail')}",
                        type: 'post',
                        data:{
                            email : function(){
                                return $("input[name=email]").val();
                            }
                        }
                    }
                }
                
            },
            messages : {
                name : {
                    required : '用户名不能为空',
                    minlength:  '用户名必须在3-15个字符之间',
                    maxlength : '用户名必须在3-15个字符之间',
                    remote	 : '该用户名已经存在'
                },
                password  : {
                    required : '密码不能为空',
                    minlength: '密码长度应在6-15个字符之间',
                    maxlength: '密码长度应在6-15个字符之间'
                },
                password_confirm : {
                    required : '请再次输入您的密码',
                    equalTo  : '两次输入的密码不一致'
                },
                email : {
                    required : '电子邮箱不能为空',
                    email    : '邮箱格式有误',
                    remote	 : '该电子邮箱已经存在'
                }
                
            }
        });
    });

</script>
<div id="wrap">
    <div id="container" class="clearfix">
        <div class="login shadow" style="padding-bottom:20px;">
            <div class="login-title">
                <h3>用户注册</h3>
            </div>
            <form id="form" name="form" method="post" action="__URL__/reg_post" class="common-form" >
                <ul class="ul_login">
                    <li class="login_mail">
                        <label>用户名：</label>
                        <input type="text"  name="name"  autocomplete="off"/>
                    </li>

                    <li class="login_password">
                        <label>密码：</label>
                        <input id="password" type="password" name="password" maxlength="15">
                    </li>
                    <li class="sure_password">
                        <label>确认密码：</label>
                        <input id="password_confirm" name="password_confirm" type="password"   maxlength="15">
                    </li>
                    <li class="login_name">
                        <label>邮箱：</label>
                        <input type="text" id="email" name="email"  autocomplete="off" />
                    </li>
                    <li class="regist_btn">
                        <input type="submit" name="RegistIn" value="注册"  id="RegistIn" />
                        <span id="regist_result">注册失败</span>
                    </li>

                </ul>
            </form>

            <div class="member">
                <span>已有{$config.title}帐号？</span>
                <a href="{:U('Login/index')}" class="loginBtn">请登录</a>
                <div class="othLogin">
                    <p>使用合作网站帐号登录{$config.title}：</p>
                    <foreach name="threeLogin" item="row">
                        <a href="{:U('Index/login',array('type'=>$row['code']))}">
                            <img src="__APP__/{$row.logo}" alt="{$row.name}" />
                        </a> 
                            </foreach>

                </div>
                <!--end of othLogin-->
            </div>

        </div>
        <!--end of login-->
    </div>

    <include file="Public:foot" />